package com.dianning.web.action.ticket;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.*;

import com.dianning.bean.Area;
import com.dianning.bean.ChannelContact;
import com.dianning.bean.Company;
import com.dianning.bean.Info;
import com.dianning.bean.InfoExpand;
import com.dianning.bean.Money;
import com.dianning.bean.Parameter;
import com.dianning.bean.Profile;
import com.dianning.bean.Resume;
import com.dianning.bean.TradingArea;
import com.dianning.bean.UserDetail;
import com.dianning.bean.UserInfo;
import com.dianning.bean.Visitor;
import com.dianning.comm.ChannelConfig;
import com.dianning.comm.Constant;
import com.dianning.comm.DianningUtil;
import com.dianning.comm.OrderObj;
import com.dianning.comm.Util;
import com.dianning.exception.DianningException;
import com.dianning.service.AreaService;
import com.dianning.service.ChannelService;
import com.dianning.service.InfoService;
import com.dianning.service.ParameterService;
import com.dianning.service.UserInfoService;
import com.dianning.service.VisitorService;
import com.dianning.service.web.PageList;
import com.dianning.service.web.Pages;
import com.dianning.web.action.BaseAction;
import com.dianning.web.interceptor.RemoteAddrAware;
import com.dianning.web.interceptor.UserSessionAware;
import com.dianning.web.servlet.UserSession;
import com.dianning.web.ui.OptionsLong;

public class Huochepiao extends BaseAction implements UserSessionAware{

	private static final Log logger = LogFactory.getLog(Huochepiao.class);
	
	private InfoService infoService;
	private ChannelService channelService;
	private ParameterService parameterService;
	private AreaService areaService;
	private UserInfoService userInfoService;


	public InfoService getInfoService() {
		return infoService;
	}

	public void setInfoService(InfoService infoService) {
		this.infoService = infoService;
	}
	
	public ChannelService getChannelService() {
		return channelService;
	}

	public void setChannelService(ChannelService channelService) {
		this.channelService = channelService;
	}

	public ParameterService getParameterService() {
		return parameterService;
	}

	public void setParameterService(ParameterService parameterService) {
		this.parameterService = parameterService;
	}

	public AreaService getAreaService() {
		return areaService;
	}

	public void setAreaService(AreaService areaService) {
		this.areaService = areaService;
	}

	public UserInfoService getUserInfoService() {
		return userInfoService;
	}

	public void setUserInfoService(UserInfoService userInfoService) {
		this.userInfoService = userInfoService;
	}
	
	private UserSession userSession;

	public UserSession getUserSession() {
		return userSession;
	}

	public void setUserSession(UserSession userSession) {
		this.userSession = userSession;
	}
	
	private List ticketSelltrainTypeList = new ArrayList();
	private List ticketBuytrainTypeList = new ArrayList();

	public List getTicketSelltrainTypeList() {
		return ticketSelltrainTypeList;
	}

	public void setTicketSelltrainTypeList(List ticketSelltrainTypeList) {
		this.ticketSelltrainTypeList = ticketSelltrainTypeList;
	}

	public List getTicketBuytrainTypeList() {
		return ticketBuytrainTypeList;
	}

	public void setTicketBuytrainTypeList(List ticketBuytrainTypeList) {
		this.ticketBuytrainTypeList = ticketBuytrainTypeList;
	}

	private void setTicketSelltrainTypeListValues(){
		List l = this.getParameterService().findParameters("ticketSelltrainType", 2, null, "orders", 0);
		for(int i=0;i<l.size();i++){
			Parameter p = (Parameter) l.get(i);
			ticketSelltrainTypeList.add(new OptionsLong(p.getId(), p.getParamName()));
		}
	}
	private void setTicketBuytrainTypeListValues(){
		List l = this.getParameterService().findParameters("ticketBuytrainType", 2, null, "orders", 0);
		for(int i=0;i<l.size();i++){
			Parameter p = (Parameter) l.get(i);
			ticketBuytrainTypeList.add(new OptionsLong(p.getId(), p.getParamName()));
		}
	}
	
	private void initValues(){
		setTicketSelltrainTypeListValues();
		setTicketBuytrainTypeListValues();
		this.setBigChannel(this.getChannelService().findChannelContactById(this.bid));
		this.setSmallChannel(this.getChannelService().findChannelContactById(this.sid));
		this.setArea(this.getAreaService().findAreaById(this.areaId));
		if(this.areaId == -1){
			this.areaId = 0;
		}
		if(this.tid == -1){
			this.tid = 0;
		}
		this.setTradingArea(this.getAreaService().findTradingAreaById(this.tid));
	}
	
	private long id;
	private long bid = ChannelConfig.TICKET_ID;
	private long sid = ChannelConfig.TICKET_HUOCHEPIAO_ID;
	private long areaId = -1;
	private long allTop = 1;
	private long tid = -1;
	private String title = "";
	private int isbiz = -1;
	private boolean biz = false;
	private boolean profile = true;
	private String content;
	private List photo;
	private int photonum;
	private String linkman;
	private String phone;
	
	private long objtype = 0;
	private String startStation = "";
	private String endStation = "";
	private String trainNum = "";
	private String startTime = "";
	private String endTime = "";
	private long ticketSelltrainType = -1;
	private long ticketBuytrainType = -1;
	private long count = 0;
	
	public long getId() {
		return id;
	}

	public void setId(long id) {
		this.id = id;
	}

	public long getBid() {
		return bid;
	}

	public void setBid(long bid) {
		this.bid = bid;
	}

	public long getSid() {
		return sid;
	}

	public void setSid(long sid) {
		this.sid = sid;
	}public long getAreaId() {
		return areaId;
	}

	public void setAreaId(long areaId) {
		this.areaId = areaId;
	}

	public long getAllTop() {
		return allTop;
	}

	public void setAllTop(long allTop) {
		this.allTop = allTop;
	}


	public long getTid() {
		return tid;
	}

	public void setTid(long tid) {
		this.tid = tid;
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public long getObjtype() {
		return objtype;
	}

	public void setObjtype(long objtype) {
		this.objtype = objtype;
	}

	public String getStartStation() {
		return startStation;
	}

	public void setStartStation(String startStation) {
		this.startStation = startStation;
	}

	public String getEndStation() {
		return endStation;
	}

	public void setEndStation(String endStation) {
		this.endStation = endStation;
	}

	public String getTrainNum() {
		return trainNum;
	}

	public void setTrainNum(String trainNum) {
		this.trainNum = trainNum;
	}

	public String getStartTime() {
		return startTime;
	}

	public void setStartTime(String startTime) {
		this.startTime = startTime;
	}

	public String getEndTime() {
		return endTime;
	}

	public void setEndTime(String endTime) {
		this.endTime = endTime;
	}

	public long getTicketSelltrainType() {
		return ticketSelltrainType;
	}

	public void setTicketSelltrainType(long ticketSelltrainType) {
		this.ticketSelltrainType = ticketSelltrainType;
	}

	public long getTicketBuytrainType() {
		return ticketBuytrainType;
	}

	public void setTicketBuytrainType(long ticketBuytrainType) {
		this.ticketBuytrainType = ticketBuytrainType;
	}

	public long getCount() {
		return count;
	}

	public void setCount(long count) {
		this.count = count;
	}

	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	public String getLinkman() {
		return linkman;
	}

	public void setLinkman(String linkman) {
		this.linkman = linkman;
	}

	public String getPhone() {
		return phone;
	}

	public void setPhone(String phone) {
		this.phone = phone;
	}

	public int getIsbiz() {
		return isbiz;
	}

	public void setIsbiz(int isbiz) {
		this.isbiz = isbiz;
	}

	public boolean isBiz() {
		return biz;
	}

	public void setBiz(boolean biz) {
		this.biz = biz;
	}

	public boolean isProfile() {
		return profile;
	}

	public void setProfile(boolean profile) {
		this.profile = profile;
	}


	public List getPhoto() {
		return photo;
	}

	public void setPhoto(List photo) {
		this.photo = photo;
	}

	public int getPhotonum() {
		return photonum;
	}

	public void setPhotonum(int photonum) {
		this.photonum = photonum;
	}
	
	private Info info;
	private List sameAreas;
	private List sameUsers;
	private PageList pageList;
	private List areas;
	private String domain = Constant.DOMAIN;
	private String profileDomain = Constant.PROFILE_DOMAIN;
	private ChannelContact bigChannel;
	private ChannelContact smallChannel;
	private Area area;
	private TradingArea tradingArea;
	private Date date0;
	private Date date1;
	private Date date2;
	private Date date3;
	private Date date4;
	private Date date5;
	private Date date6;
	private String sdate0;
	private String sdate1;
	private String sdate2;
	private String sdate3;
	private String sdate4;
	private String sdate5;
	private String sdate6;
	
	public Info getInfo() {
		return info;
	}

	public void setInfo(Info info) {
		this.info = info;
	}
	
	public List getSameAreas() {
		return sameAreas;
	}

	public void setSameAreas(List sameAreas) {
		this.sameAreas = sameAreas;
	}

	public List getSameUsers() {
		return sameUsers;
	}

	public void setSameUsers(List sameUsers) {
		this.sameUsers = sameUsers;
	}

	public PageList getPageList() {
		return pageList;
	}

	public void setPageList(PageList pageList) {
		this.pageList = pageList;
	}

	public List getAreas() {
		return areas;
	}

	public void setAreas(List areas) {
		this.areas = areas;
	}
	

	public String getDomain() {
		return domain;
	}

	public void setDomain(String domain) {
		this.domain = domain;
	}

	public String getProfileDomain() {
		return profileDomain;
	}

	public void setProfileDomain(String profileDomain) {
		this.profileDomain = profileDomain;
	}

	public ChannelContact getBigChannel() {
		return bigChannel;
	}

	public void setBigChannel(ChannelContact bigChannel) {
		this.bigChannel = bigChannel;
	}

	public ChannelContact getSmallChannel() {
		return smallChannel;
	}

	public void setSmallChannel(ChannelContact smallChannel) {
		this.smallChannel = smallChannel;
	}

	public Area getArea() {
		return area;
	}

	public void setArea(Area area) {
		this.area = area;
	}

	public TradingArea getTradingArea() {
		return tradingArea;
	}

	public void setTradingArea(TradingArea tradingArea) {
		this.tradingArea = tradingArea;
	}

	public Date getDate0() {
		return date0;
	}

	public void setDate0(Date date0) {
		this.date0 = date0;
	}

	public Date getDate1() {
		return date1;
	}

	public void setDate1(Date date1) {
		this.date1 = date1;
	}

	public Date getDate2() {
		return date2;
	}

	public void setDate2(Date date2) {
		this.date2 = date2;
	}

	public Date getDate3() {
		return date3;
	}

	public void setDate3(Date date3) {
		this.date3 = date3;
	}

	public Date getDate4() {
		return date4;
	}

	public void setDate4(Date date4) {
		this.date4 = date4;
	}

	public Date getDate5() {
		return date5;
	}

	public void setDate5(Date date5) {
		this.date5 = date5;
	}

	public Date getDate6() {
		return date6;
	}

	public void setDate6(Date date6) {
		this.date6 = date6;
	}

	public String getSdate0() {
		return sdate0;
	}

	public void setSdate0(String sdate0) {
		this.sdate0 = sdate0;
	}

	public String getSdate1() {
		return sdate1;
	}

	public void setSdate1(String sdate1) {
		this.sdate1 = sdate1;
	}

	public String getSdate2() {
		return sdate2;
	}

	public void setSdate2(String sdate2) {
		this.sdate2 = sdate2;
	}

	public String getSdate3() {
		return sdate3;
	}

	public void setSdate3(String sdate3) {
		this.sdate3 = sdate3;
	}

	public String getSdate4() {
		return sdate4;
	}

	public void setSdate4(String sdate4) {
		this.sdate4 = sdate4;
	}

	public String getSdate5() {
		return sdate5;
	}

	public void setSdate5(String sdate5) {
		this.sdate5 = sdate5;
	}

	public String getSdate6() {
		return sdate6;
	}

	public void setSdate6(String sdate6) {
		this.sdate6 = sdate6;
	}

	public String execute() {
		try {
			return this.executeMethod(this.getAction());
		} catch (Exception e) {
			logger.error(e);
			return ERROR;
		}
	}

	public String index(){
		this.setInfo(this.getInfoService().findInfoById(this.id));
		if(this.getInfo() == null){
			return "infodisable";
		}else{
			if(this.getInfo().getValidated() == 2){
				return "infodisable";
			}
		}
		this.setSameAreas(this.getInfoService().findInfos(id,-1, this.getInfo().getCcid(), 1, 1, -1, "addTime", 1, 1, 5));
		this.setSameUsers(this.getInfoService().findInfos(id,this.getInfo().getUid(), this.getInfo().getCcid(), 1, 1, -1, "addTime", 1, 1, 5));
        return "index";
	}
	
	public String list(){
		if(this.areaId == 0){
			this.areaId = -1;
		}
		if(this.tid == 0){
			this.tid = -1;
		}
		this.setAreas(this.getAreaService().findAreas("orders", 0));
		this.date0 = new Date();
		this.sdate0 = Util.formatDate(this.date0, "yyyy-MM-dd");
		this.date1 = new Date(new Date().getTime() + 1*1000*60*60*24);
		this.sdate1 = Util.formatDate(this.date1, "yyyy-MM-dd");
		this.date2 = new Date(new Date().getTime() + 2*1000*60*60*24);
		this.sdate2 = Util.formatDate(this.date2, "yyyy-MM-dd");
		this.date3 = new Date(new Date().getTime() + 3*1000*60*60*24);
		this.sdate3 = Util.formatDate(this.date3, "yyyy-MM-dd");
		this.date4 = new Date(new Date().getTime() + 4*1000*60*60*24);
		this.sdate4 = Util.formatDate(this.date4, "yyyy-MM-dd");
		this.date5 = new Date(new Date().getTime() + 5*1000*60*60*24);
		this.sdate5 = Util.formatDate(this.date5, "yyyy-MM-dd");
		this.date6 = new Date(new Date().getTime() + 6*1000*60*60*24);
		this.sdate6 = Util.formatDate(this.date6, "yyyy-MM-dd");
		Pages pages = new Pages();
		pages.setPage(this.getPage());
		pages.setPerPageNum(Constant.PAGE_NUM);
		if (this.getTotal() > 0) {
			pages.setTotalNum(this.getTotal());
		}
		pages.setFileName("/ticket/huochepiao.action?action=list&startStation="+this.startStation+"&endStation="+this.endStation+"&trainNum="+this.trainNum+"&startTime="+this.startTime);
		List wherein = new ArrayList();
		if(StringUtils.isNotBlank(startStation)){
			wherein.add("keyword='startStation' and svalue like '%" + startStation + "%'");		
		}
		if(StringUtils.isNotBlank(endStation)){
			wherein.add("keyword='endStation' and svalue like '%" + endStation + "%'");		
		}
		if(StringUtils.isNotBlank(trainNum)){
			wherein.add("keyword='trainNum' and svalue like '%" + trainNum + "%'");		
		}
		if(StringUtils.isNotBlank(startTime)){
			wherein.add("keyword='startTime' and svalue = '" + startTime + "'");		
		}

		OrderObj commend = new OrderObj();
		commend.setOrderBy("isCommend");
		commend.setAscOrDesc(1);
		OrderObj top = new OrderObj();
		if(this.areaId == -1){
			top.setOrderBy("isCityTop");
			top.setAscOrDesc(1);
		}else{
			this.allTop = -1;
			top.setOrderBy("isAreaTop");
			top.setAscOrDesc(1);
		}
		OrderObj up = new OrderObj();
		up.setOrderBy("upTime");
		up.setAscOrDesc(1);
		OrderObj[] oo = {commend,top,up};
		this.setPageList(this.getInfoService().findInfos(-1, -1, sid, areaId, tid, isbiz, 1, 1,-1,title, wherein, oo, pages));
		return "list";
	}
	public String post(){
		initValues();
		this.setAction("dopost");
		UserInfo ui = this.getUserInfoService().findUserInfoByUid(userSession.getUid());
		this.setLinkman(ui.getName());
		this.setPhone(ui.getUserDetail().getMobile());
		return "post";
	}
	
	public String dopost(){
		ChannelContact cc = this.getChannelService().findChannelContactById(this.sid);
		Info info = new Info();
		info.setCid(cc.getChannelId());
		info.setCcid(this.sid);
		info.setTitle(DianningUtil.filterKeyword(this.title));
		info.setContent(DianningUtil.filterKeyword(this.content));
		info.setAreaId(this.areaId);
		info.setTradingareaId(this.tid);
		info.setUid(this.userSession.getUid());
		info.setName(this.linkman);
		info.setTel(this.phone);
		info.setIsbiz(boolean2int(this.biz));
		info.setIsProfile(boolean2int(this.profile));
		info.setPhoto(this.photo);
		if(this.photo==null || this.photo.isEmpty()){
			info.setPhotonum(0);
		}else{
			info.setPhotonum(this.photo.size());
		}
		info.setAvatar("");
		info.setValidated(0);
		info.setStatus(1);
		info.setAddTime(new Date());
		info.setUpTime(new Date());
		info.setIsCityTop(0);
		info.setCityTopTime(new Date());
		info.setIsAreaTop(0);
		info.setAreaTopTime(new Date());
		info.setIsCommend(0);
		info.setCommendTime(new Date());
		
		List infoExpands = new ArrayList();
		//objtype
		InfoExpand infoObjtype = new InfoExpand();
		infoObjtype.setKeyword("objtype");
		if(this.objtype==0){
			infoObjtype.setSvalue("出售");
		}
		if(this.objtype==1){
			infoObjtype.setSvalue("求购");
		}
		infoObjtype.setIvalue(this.objtype);
		infoExpands.add(infoObjtype);
		//startStation
		InfoExpand infoStartStation = new InfoExpand();
		infoStartStation.setKeyword("startStation");
		infoStartStation.setSvalue(this.startStation);
		infoStartStation.setIvalue(0);
		infoExpands.add(infoStartStation);
		//endStation
		InfoExpand infoEndStation = new InfoExpand();
		infoEndStation.setKeyword("endStation");
		infoEndStation.setSvalue(this.endStation);
		infoEndStation.setIvalue(0);
		infoExpands.add(infoEndStation);
		//trainNum
		InfoExpand infoTrainNum = new InfoExpand();
		infoTrainNum.setKeyword("trainNum");
		infoTrainNum.setSvalue(this.trainNum);
		infoTrainNum.setIvalue(0);
		infoExpands.add(infoTrainNum);
		//startTime
		InfoExpand infoStartTime = new InfoExpand();
		infoStartTime.setKeyword("startTime");
		infoStartTime.setSvalue(this.startTime);
		infoStartTime.setIvalue(0);
		infoExpands.add(infoStartTime);
		//endTime
		InfoExpand infoEndTime = new InfoExpand();
		infoEndTime.setKeyword("endTime");
		infoEndTime.setSvalue(this.endTime);
		infoEndTime.setIvalue(0);
		infoExpands.add(infoEndTime);
		//ticketSelltrainType
		Parameter pSelltrainType = this.getParameterService().findParameterById(this.ticketSelltrainType);
		InfoExpand infoSelltrainType = new InfoExpand();
		infoSelltrainType.setKeyword("ticketSelltrainType");
		infoSelltrainType.setSvalue(pSelltrainType.getParamName());
		infoSelltrainType.setIvalue(this.ticketSelltrainType);
		infoExpands.add(infoSelltrainType);
		//ticketBuytrainType
		Parameter pBuytrainType = this.getParameterService().findParameterById(this.ticketBuytrainType);
		InfoExpand infoBuytrainType = new InfoExpand();
		infoBuytrainType.setKeyword("ticketBuytrainType");
		infoBuytrainType.setSvalue(pBuytrainType.getParamName());
		infoBuytrainType.setIvalue(this.ticketBuytrainType);
		infoExpands.add(infoBuytrainType);	
		//count
		InfoExpand infoCount = new InfoExpand();
		infoCount.setKeyword("count");
		infoCount.setSvalue(String.valueOf(this.count));
		infoCount.setIvalue(this.count);
		infoExpands.add(infoCount);
		
		info = this.getInfoService().saveInfo(info, infoExpands);
		this.id = info.getId();
		return "dopost";
	}
	

	public String update(){
		
		this.setAction("doupdate");
		this.setInfo(this.getInfoService().findInfoById(this.id));
		if(this.getInfo() == null){
			return "infodisable";
		}else{
			if(this.getInfo().getValidated() == 2){
				return "infodisable";
			}
		}
		ChannelContact cc = this.getChannelService().findChannelContactById(this.sid);
		this.bid = cc.getParentId();
		this.sid = this.info.getCcid();
		this.areaId = this.info.getAreaId();
		this.tid = this.info.getTradingareaId();
		this.title = this.info.getTitle();
		this.content = this.info.getContent();
		this.linkman = this.info.getName();
		this.phone = this.info.getTel();
		this.biz = int2boolean(this.info.getIsbiz());
		this.profile = int2boolean(this.info.getIsProfile());
		this.photo = this.info.getPhoto();
		this.photonum = this.info.getPhotonum();

		//objtype
		InfoExpand infoObjtype = this.getInfoService().findInfoExpandByInfoIdKeyword(this.id, "objtype");
		this.objtype = infoObjtype.getIvalue();
		//startStation
		InfoExpand infoStartStation = this.getInfoService().findInfoExpandByInfoIdKeyword(this.id, "startStation");
		this.startStation = infoStartStation.getSvalue();
		//endStation
		InfoExpand infoEndStation = this.getInfoService().findInfoExpandByInfoIdKeyword(this.id, "endStation");
		this.endStation = infoEndStation.getSvalue();
		//trainNum
		InfoExpand infoTrainNum = this.getInfoService().findInfoExpandByInfoIdKeyword(this.id, "trainNum");
		this.trainNum = infoTrainNum.getSvalue();
		//startTime
		InfoExpand infoStartTime = this.getInfoService().findInfoExpandByInfoIdKeyword(this.id, "startTime");
		this.startTime = infoStartTime.getSvalue();
		//endTime
		InfoExpand infoEndTime = this.getInfoService().findInfoExpandByInfoIdKeyword(this.id, "endTime");
		this.endTime = infoEndTime.getSvalue();
		//ticketSelltrainType
		InfoExpand infoSelltrainType = this.getInfoService().findInfoExpandByInfoIdKeyword(this.id, "ticketSelltrainType");
		this.ticketSelltrainType = infoSelltrainType.getIvalue();
		//ticketBuytrainType
		InfoExpand infoBuytrainType = this.getInfoService().findInfoExpandByInfoIdKeyword(this.id, "ticketBuytrainType");
		this.ticketBuytrainType = infoBuytrainType.getIvalue();
		//count
		InfoExpand infoCount = this.getInfoService().findInfoExpandByInfoIdKeyword(this.id, "count");
		this.count = infoCount.getIvalue();
		
		initValues();
		return "update";
	}
	
	public String doupdate(){
		ChannelContact cc = this.getChannelService().findChannelContactById(this.sid);
		Info info = this.getInfoService().findInfoById(this.id);
		info.setCid(cc.getChannelId());
		info.setCcid(this.sid);
		info.setTitle(DianningUtil.filterKeyword(this.title));
		info.setContent(DianningUtil.filterKeyword(this.content));
		info.setAreaId(this.areaId);
		info.setTradingareaId(this.tid);
		info.setUid(this.userSession.getUid());
		info.setName(this.linkman);
		info.setTel(this.phone);
		info.setIsbiz(boolean2int(this.biz));
		info.setIsProfile(boolean2int(this.profile));
		info.setPhoto(this.photo);
		if(this.photo==null || this.photo.isEmpty()){
			info.setPhotonum(0);
		}else{
			info.setPhotonum(this.photo.size());
		}
		
		List infoExpands = new ArrayList();
		//objtype
		InfoExpand infoObjtype = this.getInfoService().findInfoExpandByInfoIdKeyword(this.id, "objtype");
		infoObjtype.setKeyword("objtype");
		if(this.objtype==0){
			infoObjtype.setSvalue("出售");
		}
		if(this.objtype==1){
			infoObjtype.setSvalue("求购");
		}
		infoObjtype.setIvalue(this.objtype);
		infoExpands.add(infoObjtype);
		//startStation
		InfoExpand infoStartStation = this.getInfoService().findInfoExpandByInfoIdKeyword(this.id, "startStation");
		infoStartStation.setKeyword("startStation");
		infoStartStation.setSvalue(this.startStation);
		infoStartStation.setIvalue(0);
		infoExpands.add(infoStartStation);
		//endStation
		InfoExpand infoEndStation = this.getInfoService().findInfoExpandByInfoIdKeyword(this.id, "endStation");
		infoEndStation.setKeyword("endStation");
		infoEndStation.setSvalue(this.endStation);
		infoEndStation.setIvalue(0);
		infoExpands.add(infoEndStation);
		//trainNum
		InfoExpand infoTrainNum = this.getInfoService().findInfoExpandByInfoIdKeyword(this.id, "trainNum");
		infoTrainNum.setKeyword("trainNum");
		infoTrainNum.setSvalue(this.trainNum);
		infoTrainNum.setIvalue(0);
		infoExpands.add(infoTrainNum);
		//startTime
		InfoExpand infoStartTime = this.getInfoService().findInfoExpandByInfoIdKeyword(this.id, "startTime");
		infoStartTime.setKeyword("startTime");
		infoStartTime.setSvalue(this.startTime);
		infoStartTime.setIvalue(0);
		infoExpands.add(infoStartTime);
		//endTime
		InfoExpand infoEndTime = this.getInfoService().findInfoExpandByInfoIdKeyword(this.id, "endTime");
		infoEndTime.setKeyword("endTime");
		infoEndTime.setSvalue(this.endTime);
		infoEndTime.setIvalue(0);
		infoExpands.add(infoEndTime);
		//ticketSelltrainType
		Parameter pSelltrainType = this.getParameterService().findParameterById(this.ticketSelltrainType);
		InfoExpand infoSelltrainType = this.getInfoService().findInfoExpandByInfoIdKeyword(this.id, "ticketSelltrainType");
		infoSelltrainType.setKeyword("ticketSelltrainType");
		infoSelltrainType.setSvalue(pSelltrainType.getParamName());
		infoSelltrainType.setIvalue(this.ticketSelltrainType);
		infoExpands.add(infoSelltrainType);
		//ticketBuytrainType
		Parameter pBuytrainType = this.getParameterService().findParameterById(this.ticketBuytrainType);
		InfoExpand infoBuytrainType = this.getInfoService().findInfoExpandByInfoIdKeyword(this.id, "ticketBuytrainType");
		infoBuytrainType.setKeyword("ticketBuytrainType");
		infoBuytrainType.setSvalue(pBuytrainType.getParamName());
		infoBuytrainType.setIvalue(this.ticketBuytrainType);
		infoExpands.add(infoBuytrainType);	
		//count
		InfoExpand infoCount = this.getInfoService().findInfoExpandByInfoIdKeyword(this.id, "count");
		infoCount.setKeyword("count");
		infoCount.setSvalue(String.valueOf(this.count));
		infoCount.setIvalue(this.count);
		infoExpands.add(infoCount);

		info = this.getInfoService().updateInfo(info, infoExpands);
		return "doupdate";
	}







}
